<template>
  <div class="homeindex">
    <Carousel />
    <Banner />
    <Advertising />
    <Introduce />
    <Preference />
    <div class="routera">
      <van-sticky :offset-top="0">
        <div class="bgc">
        <div class="router_l">
          <router-link to="/newm"> 遇新季 </router-link>
          <router-link to="/self"> 瑞幸自营 </router-link>
          <router-link to="/cwater"> 咖啡水具 </router-link>
          <router-link to="/snacks">糕点零食 </router-link>
          <router-link to="/tide">
            <span class="span2">
              更多商品
              <svg class="icon icona" aria-hidden="true">
                <use xlink:href="#icon-dayuhao" />
              </svg>
            </span>
          </router-link>
          </div>
        </div>
      </van-sticky>

      <router-view></router-view>
    </div>
    <Bbat />
  </div>
</template>

<script>
import Carousel from "@/components/home/carousel.vue";
import Banner from "@/components/home/banner.vue";
import Advertising from "@/components/home/advertising.vue";
import Introduce from "@/components/home/introduce.vue";
import Preference from "@/components/home/preference.vue";
export default {
  name: "Home",
  components: {
    Carousel,
    Banner,
    Advertising,
    Introduce,
    Preference
  },
      mounted(){ 
        // this.$router.push("/newm");
        // console.log(window.localStorage.getItem("login"))
        if( window.localStorage.getItem("login")!=null&& window.localStorage.getItem("login")!=undefined){
          console.log(1)
          this.$store.state.elsem.login =  window.localStorage.getItem("login")
        }
        
        this.$store.dispatch("actiondemoa",{url:"/mock"});    
    }
};
</script>
<style scoped>
.home{
  overflow: auto;
}
/* .span3{
  display: block;
  width: 0.7rem;
  height: 0.5rem;
  background-color: white;
} */
template{
    width: 100%;
  height: 100%;
  display: auto;
}
.span2 {
  background-color: white;
  position: absolute;
  right: 0.05rem;
  top: 0.01rem;
  font-size: 0.05rem;
}
.icona {
  width: 0.1rem;
  height: 0.1rem;
}
.router-link-active {
  font-weight: 900;
  /* margin: auto; */
  height: 0.45rem;

  background-color: rgb(255, 255, 255);
  border-bottom: 2px solid red;
}
.bgc{
  width: 3.6rem;
  height: 0.45rem;
  margin: auto;
  background-color: white;

}
.routera{
  position: relative;
  margin: auto;
  width: 3.6rem;
  height: 0.45rem;
  line-height: 0.45rem;
  font-size: 0.15rem;
  background-color: red;
}
.router_l{
  background-color: white;
  display: flex;
  justify-content: space-around;
  width: 2.6rem;
}
.van-sticky{
  width: 3.6rem;
  margin: auto;
  background-color: white;

}
/* .routera>div>.van-sticky--fixed{
  position: static
} */
</style>
